Current Location: Home> Function Categories> date_format

date_format

Alias ​​for DateTime::format - Returns the date set according to the given format
Name:date_format
Category:Date and time
Programming Language:php
One-line Description:Returns the date formatted according to the specified format.

Definition and usage

date_format() function returns the date formatted according to the specified format.

Example

Return a new DateTime object and format the date:

 <?php
$date = date_create ( "2016-09-25" ) ;
echo date_format ( $date , "Y/m/d H:i:s" ) ;
?>

Try it yourself

grammar

 date_format ( object , format ) ;
parameter describe
object Required. Specifies the DateTime object returned by date_create() .
format Required. Format for specified dates.
Similar Functions